package com.ylsk.mobilecheck.controller;
import com.ylsk.check.domain.ExpresswaySection;
import com.ylsk.check.domain.dto.*;
import com.ylsk.check.domain.so.*;
import com.ylsk.check.domain.vo.*;
import com.ylsk.common.core.controller.BaseController;
import com.ylsk.common.core.domain.AjaxResult;
import com.ylsk.common.core.page.TableDataInfo;
import com.ylsk.mobilecheck.service.ConstructionMobileService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 施工方移动端控制器
 *
 * @author ysy
 * @date 2023-12-03
 */
@Api(tags = "移动端-施工方端接口")
@RestController
@RequestMapping("/mobileCheck/construction/")
public class ConstructionController extends BaseController
{

    @Autowired
    private ConstructionMobileService constructionMobileService;

    /**
     * 查询报备信息列表
     */
    @GetMapping("listReportInfo")
    public TableDataInfo listReportInfo(ReportInfoSO reportInfoSO)
    {
        startPage();
        List<ReportInfoVO> list = constructionMobileService.listReportInfo(reportInfoSO);
        return getDataTable(list);
    }

    /**
     * 查询报备信息不分页列表
     */
    @GetMapping("selectListReportInfo")
    public AjaxResult selectListReportInfo(ReportInfoSO reportInfoSO)
    {
        List<ReportInfoVO> list = constructionMobileService.selectListReportInfo(reportInfoSO);
        return AjaxResult.success(list);
    }

    /**
     * 保存项目报备信息
     * @param reportInfoDTO
     * @return
     */

    @PostMapping("saveReportInfo")
    public AjaxResult saveReportInfo(@RequestBody ReportInfoDTO reportInfoDTO)
    {
        return toAjax(constructionMobileService.saveReportInfo(reportInfoDTO));
    }

    /**
     * 查看项目报备信息
     * @param reportInfoId
     * @return
     */
    @GetMapping("getReportInfo")
    public AjaxResult getReportInfo(Long reportInfoId)
    {
        return success(constructionMobileService.getReportInfo(reportInfoId));
    }

    /**
     * 修改项目报备信息
     * @param reportInfoDTO
     * @return
     */
    @PostMapping("updateReportInfo")
    public AjaxResult updateReportInfo(@RequestBody ReportInfoDTO reportInfoDTO)
    {
        return toAjax(constructionMobileService.updateReportInfo(reportInfoDTO));
    }

    /**
     * 删除项目报备信息
     */
    @GetMapping("/removeReportInfo")
    public AjaxResult removeReportInfo(Long reportInfoId)
    {
        return toAjax(constructionMobileService.removeReportInfo(reportInfoId));
    }

    /**
     * 项目报备信息 审批记录列表
     */
    @GetMapping("/listReportInfoApprRecord")
    public AjaxResult listReportInfoApprRecord(Long reportInfoId)
    {
        List<ReportApprLogVO> list = constructionMobileService.listReportInfoApprRecord(reportInfoId);
        return success(list);
    }
    /**
     * 获取高速路段列表信息
     * @param expresswaySection
     * @return
     */
    @GetMapping("getExpresswaySectionList")
    public AjaxResult getExpresswaySectionList(ExpresswaySection expresswaySection)
    {
        List<ExpresswaySectionVO> list = constructionMobileService.getExpresswaySectionList(expresswaySection);
        return success(list);
    }

    /**
     * 查询进场上报列表
     */
    @GetMapping("/listEntryReport")
    public TableDataInfo listEntryReport(EntryReportSO entryReportSO)
    {
        startPage();
        List<EntryReportVO> list = constructionMobileService.listEntryReport(entryReportSO);
        return getDataTable(list);
    }

    /**
     * 保存进场上报信息
     */
    @PostMapping("/saveEntryReport")
    public AjaxResult saveEntryReport(@RequestBody EntryReportDTO entryReportDTO)
    {
        return toAjax(constructionMobileService.saveEntryReport(entryReportDTO));
    }

    /**
     * 进场上报详情
     */
    @GetMapping("/getEntryReport")
    public AjaxResult getEntryReport(Long entryReportId)
    {
        return success(constructionMobileService.getEntryReport(entryReportId));
    }

    /**
     * 查询撤场上报列表
     */
    @GetMapping("/listWithdrawalReport")
    public TableDataInfo listWithdrawalReport(WithdrawalReportSO withdrawalReportSO)
    {
        startPage();
        List<WithdrawalReportVO> list = constructionMobileService.listWithdrawalReport(withdrawalReportSO);
        return getDataTable(list);
    }

    /**
     * 保存撤场上报信息
     */
    @PostMapping("/saveWithdrawalReport")
    public AjaxResult saveWithdrawalReport(@RequestBody WithdrawalReportDTO withdrawalReportDTO)
    {
        return toAjax(constructionMobileService.saveWithdrawalReport(withdrawalReportDTO));
    }

    /**
     * 撤场上报详情
     */
    @GetMapping("/getWithdrawalReport")
    public AjaxResult getWithdrawalReport(Long withdrawalReportId)
    {
        return success(constructionMobileService.getWithdrawalReport(withdrawalReportId));
    }

    /**
     * 查询占道上报列表
     */
    @GetMapping("/listJeevesReport")
    public TableDataInfo listJeevesReport(JeevesReportSO jeevesReportSO)
    {
        startPage();
        List<JeevesReportVO> list = constructionMobileService.listJeevesReport(jeevesReportSO);
        return getDataTable(list);
    }

    /**
     * 保存占道上报信息
     */
    @PostMapping("/saveJeevesReport")
    public AjaxResult saveJeevesReport(@RequestBody JeevesReportDTO jeevesReportDTO)
    {
        return toAjax(constructionMobileService.saveJeevesReport(jeevesReportDTO));
    }

    /**
     * 占道上报详情
     */
    @GetMapping("/getJeevesReport")
    public AjaxResult getJeevesReport(Long jeevesReportId)
    {
        return success(constructionMobileService.getJeevesReport(jeevesReportId));
    }

    /**
     * 变动上报列表
     */
    @GetMapping("/listChangeReport")
    public TableDataInfo listChangeReport(ChangeReportSO changeReportSO)
    {
        startPage();
        List<ChangeReportVO> list = constructionMobileService.listChangeReport(changeReportSO);
        return getDataTable(list);
    }

    /**
     * 保存变动上报信息
     */
    @PostMapping("/saveChangeReport")
    public AjaxResult saveChangeReport(@RequestBody ChangeReportDTO changeReportDTO)
    {
        return toAjax(constructionMobileService.saveChangeReport(changeReportDTO));
    }

    /**
     * 变动上报详情
     */
    @GetMapping("/getChangeReport")
    public AjaxResult getChangeReport(Long changeReportId)
    {
        return success(constructionMobileService.getChangeReport(changeReportId));
    }

    /**
     * 查询施工检查问题列表
     */
    @GetMapping("/listCheckProblem")
    public TableDataInfo listCheckProblem(CheckProblemSO checkProblemSO)
    {
        startPage();
        List<CheckProblemVO> list = constructionMobileService.listCheckProblem(checkProblemSO);
        return getDataTable(list);
    }

    /**
     * 施工检查问题整改
     */
    @PostMapping("/updateCheckProblem")
    public AjaxResult updateCheckProblem(@RequestBody RectificationReportDTO rectificationReportDTO)
    {
        return toAjax(constructionMobileService.updateCheckProblem(rectificationReportDTO));
    }

    /**
     * 施工检查问题详情
     */
    @GetMapping("/getCheckProblem")
    public AjaxResult getCheckProblem(Long checkProblemId)
    {
        return success(constructionMobileService.getCheckProblem(checkProblemId));
    }

    /**
     * 施工完成列表
     */
    @GetMapping("/listProjectEnd")
    public TableDataInfo listProjectEnd(ReportInfoSO reportInfoSO)
    {
        startPage();
        List<ReportInfoVO> list = constructionMobileService.listProjectEnd(reportInfoSO);
        return getDataTable(list);
    }

    /**
     * 查询占道报备未撤场的数据
     */
    @GetMapping("/selectNotWithdrawnList")
    public AjaxResult selectList(JeevesReportSO jeevesReportSO)
    {
        List<JeevesReportVO> list = constructionMobileService.selectJeevesNotWithdrawnList(jeevesReportSO);
        return success(list);
    }
}
